<?php
header("Content-Type:text/html;charset=utf-8");
    session_start();
    include_once("conn.php");
    $adname = $_POST["adname"];
    $adpassword = $_POST["adpassword"];
    $sql_select = "select * from ad
	          where adname = '$adname' and adpassword = '$adpassword'";
			
	$ret = mysqli_query($conn,$sql_select);
	$row = mysqli_fetch_array($ret); 
				
   if($adname == $row['adname'] && $adpassword == $row['adpassword']){	
	   
	   $_SESSION['adname'] = $row['adname'];
       $_SESSION['adpassword'] = $row['adpassword'];
				header("Location:ad.php"); 
				}  
    else{
				  echo "登陆失败";
	}